package com.bedrock.framework.task;

import com.bedrock.common.utils.DateUtils;
import com.bedrock.project.inside.service.IWorkHourStatService;
import com.bedrock.project.inside.service.WorkHourService;
import com.bedrock.project.inside.service.impl.SendEmailService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 定时任务调度测试
 * 
 * @author bedrock
 */
@Component("bedrockTask")
public class BedrockTask
{

    @Autowired
    private SendEmailService sendEmailService;

    @Autowired
    private WorkHourService workHourService;

    @Autowired
    private IWorkHourStatService workHourStatService;

    private final Logger logger = LoggerFactory.getLogger(BedrockTask.class);

    public void sendRecruitMail()
    {
        logger.info("发送招聘周报定时任务：{}",DateUtils.getNowDate());
        sendEmailService.sendEmail();
    }

    public void sendWorkHourMail()
    {
        logger.info("发送工时周报定时任务：{}",DateUtils.getNowDate());
        workHourService.sendMailWeekReport();
    }
    public void sendWeekReportWarn()
    {
        logger.info("发送工时日报预警任务：{}",DateUtils.getNowDate());
        workHourService.sendWeekReportWarn();
    }

    /**
     * 工时统计-每天跑一次
     */
    public void workHourStat(){
        logger.info("工时统计任务：{}",DateUtils.getNowDate());
        workHourStatService.workHourStatisticsByDay();
    }

}
